#ifndef _RING_BUFFER_H
#define _RING_BUFFER_H

#include "sc95f.h"


typedef struct _ringbuffer_t
{
	volatile unsigned int read_index;           /* 当前读位置 */
	volatile unsigned int write_index;          /* 当前写位置 */  
	unsigned int buffer_size;					/* ringbuffer大小 */
    unsigned char *buffer_ptr;  				/* 指向ringbuffer */
} ringbuffer_t;

void ringbuffer_init(ringbuffer_t *rb, unsigned char *pool, unsigned int size);
int ringbuffer_write(unsigned char ch, ringbuffer_t *rb);
int ringbuffer_read(unsigned char *ch, ringbuffer_t *rb);

extern ringbuffer_t ringbuffer;

#endif
